package model

type OrderInfo struct {
	Id                 int    `json:"id" gorm:"primaryKey;autoIncrement;comment:主键编码"`
	OrderId            string `json:"orderId" gorm:"type:varchar(14);comment:订单号"`
	AccountId          string `json:"accountId" gorm:"type:varchar(10);comment:账户序列号"`
	UserId             string `json:"userId" gorm:"type:varchar(12);comment:用户序列号"`
	OpeningLotSize     string `json:"openingLotSize" gorm:"type:decimal(10,2) unsigned zerofill;comment:提交数量(专业模式手数，新手模式金额）"`
	ClosingLotSize     string `json:"closingLotSize" gorm:"type:decimal(10,2) unsigned zerofill;comment:已成交数量(手数)"`
	OrderType          string `json:"orderType" gorm:"type:tinyint;comment:订单类型1市价;2限价Limit买入;3限价Limit卖出;4止损Stop买入;5止损Stop卖出；8 平仓单(历史单)"`
	Side               string `json:"side" gorm:"type:tinyint;comment:交易方向buy-1  sell-2 "`
	TradePrice         string `json:"tradePrice" gorm:"type:decimal(15,5);comment:订单价格"`
	Status             string `json:"status" gorm:"type:tinyint;comment:订单状态1 已成交2 未成交3 已取消4 失败"`
	Channel            string `json:"channel" gorm:"type:tinyint;comment:渠道:1 app 2 web"`
	StopLossPrice      string `json:"stopLossPrice" gorm:"type:decimal(15,5);comment:止损价格"`
	StopProfitPrice    string `json:"stopProfitPrice" gorm:"type:decimal(15,5);comment:止盈价格"`
	CreateStamp        string `json:"createStamp" gorm:"type:bigint;comment:订单创建时间"`
	DealStamp          string `json:"dealStamp" gorm:"type:bigint;comment:订单成交时间"`
	ContractId         string `json:"contractId" gorm:"type:varchar(14);comment:持仓单序列号"`
	Swap               string `json:"swap" gorm:"type:decimal(10,2);comment:隔夜利息"`
	Commission         string `json:"commission" gorm:"type:decimal(10,2);comment:佣金"`
	Symbol             string `json:"symbol" gorm:"type:varchar(32);comment:交易品种"`
	Profit             string `json:"profit" gorm:"type:decimal(15,5);comment:交易浮亏"`
	Comment            string `json:"comment" gorm:"type:varchar(255);comment:订单注释"`
	Magic              string `json:"magic" gorm:"type:int(10) unsigned zerofill;comment:订单识别码"`
	Margin             string `json:"margin" gorm:"type:decimal(15,2);comment:保证金"`
	Leverage           string `json:"leverage" gorm:"type:int;comment:杠杆"`
	ParentId           string `json:"parentId" gorm:"type:varchar(14);comment:父订单序列号"`
	CloseLot           string `json:"closeLot" gorm:"type:decimal(10,2);comment:平仓手数"`
	CloseStamp         string `json:"closeStamp" gorm:"type:bigint;comment:平仓时间"`
	ClosePrice         string `json:"closePrice" gorm:"type:decimal(15,5);comment:平仓价格"`
	CurrencyId         string `json:"currencyId" gorm:"type:int;comment:品种ID"`
	CloseType          string `json:"closeType" gorm:"type:tinyint;comment:平仓类型：1手动平仓，2强平"`
	Ip                 string `json:"ip" gorm:"type:string;comment:ip"`
	IdentificationCode string `json:"identificationCode" gorm:"type:string;comment:identification_code"`
	MasterAccountId    string `json:"master_account_id" gorm:"column:master_account_id"`
	OrderSource        int64  `json:"order_source" gorm:"column:order_source"`
	BrokerId           string `json:"broker_id" gorm:"column:broker_id"`
	AccountType        string `json:"account_type" gorm:"column:account_type"`
	TradeType          int64  `json:"trade_type" gorm:"column:trade_type"`
}

func (OrderInfo) TableName() string {
	return "order_info"
}
